'''
Created on Dec 29, 2014 

@author: pan
'''
import os

import tornado.web
import tornado.ioloop
import tornado.httpserver


class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.render('index.html')

class InfoHandler(tornado.web.RequestHandler):
#     def initialize(self, pagenum):
#         self.pagenum = pagenum
    def get(self, pagenum):
        self.write("info page : " + pagenum)

application = tornado.web.Application(
    handlers=[
              (r"/", MainHandler),
              (r"/info/(\w+)", InfoHandler,),
              ],
    template_path = os.path.join(os.path.dirname(__file__), "template"),
    static_path = os.path.join(os.path.dirname(__file__), "static"),
    debug = True
    )

if __name__ == "__main__":
    http_server = tornado.httpserver.HTTPServer(application)
    http_server.listen(8888)
    tornado.ioloop.IOLoop.instance().start()

